<template>
  <el-form>
    <el-form-item label="用户名">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="年龄">
      <el-input v-model="form.age"></el-input>
    </el-form-item>
    <el-form-item label="住址">
      <el-input v-model="form.address"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
import EventBus from "@/lib/event-bus";

export default {
  name: "UserForm",
  props: {
    dlgProps: Object
  },
  data() {
    return {
      form: {
        name: '',
        age: 0,
        address: ''
      }
    }
  },
  methods: {
    takeFormData() {
      return {...this.form}
    }
  },
  created() {
    EventBus.$on('form-submit', (p) => {
      p.callback(this.takeFormData());
    });
  }
}
</script>

<style scoped>

</style>